package config

import (
	"github.com/BurntSushi/toml"
)

type EarthConfig struct {
	Title string
	Owner OwnerInfo
	DB    Database `toml:"database"`
}

type OwnerInfo struct {
	Name string
}

type Database struct {
	Server   string
	Port     int
	DBname   string
	Username string
	Password string
	Charset  string
}

func Init() (EarthConfig, error) {
	var Config EarthConfig

	if _, err := toml.DecodeFile("config.toml", &Config); err != nil {
		return EarthConfig{}, err
	}
	return Config, nil
}
